<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
 *
 * Link dialog window.
-->
<html>
<head>
	<title>Source Properties</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="robots" content="noindex, nofollow" />
	<script type="text/javascript">

var oEditor		= window.parent.InnerDialogLoaded() ;
var FCK			= oEditor.FCK ;
var FCKLang		= oEditor.FCKLang ;
var FCKConfig	= oEditor.FCKConfig ;
var FCKRegexLib	= oEditor.FCKRegexLib ;
var FCKTools	= oEditor.FCKTools ;

document.write( '<script src="' + FCKConfig.BasePath + 'dialog/common/fck_dialog_common.js" type="text/javascript"><\/script>' ) ;

	</script>
	<script type="text/javascript">

// Get the selected flash embed (if available).
var oFakeImage = FCK.Selection.GetSelectedElement() ;
var oSource ;

if ( oFakeImage )
{
	if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fck_mw_source') )
	{
		oSource = FCK.GetRealElement( oFakeImage ) ;
	}
	else
	{
		oFakeImage = null ;
	}
}

window.onload = function()
{
	// Translate the dialog box texts.
	oEditor.FCKLanguageManager.TranslatePage(document) ;

	// Load the selected link information (if any).
	LoadSelection() ;

	// Activate the "OK" button.
	window.parent.SetOkButton( true ) ;
	window.parent.SetAutoSize( true ) ;
}

function LoadSelection()
{
	if ( !oSource ) return ;

	GetE('xSourceText').value = FCKTools.HTMLDecode( oSource.innerHTML ).replace(/fckLR/g,'\r\n').replace( /&quot;/g, '"' );
	GetE('xSourceLang').value = oSource.getAttribute( 'lang' ) ;
}

//#### The OK button was hit.
function Ok()
{
	var supportedLanguages = ',abap,actionscript,actionscript3,ada,apache,applescript,apt_sources,asm,asp,autoit,avisynth,bash,basic4gl,bf,blitzbasic,bnf,boo,c,c_mac,caddcl,cadlisp,cfdg,cfm,cil,cobol,cpp,cpp-qt,csharp,css,d,delphi,diff,div,dos,dot,eiffel,email,fortran,freebasic,genero,gettext,glsl,gml,gnuplot,groovy,haskell,hq9plus,html4strict,idl,ini,inno,intercal,io,java,java5,javascript,kixtart,klonec,klonecpp,latex,lisp,lolcode,lotusformulas,lotusscript,lscript,lua,m68k,make,matlab,mirc,mpasm,mxml,mysql,nsis,objc,ocaml,ocaml-brief,oobas,oracle11,oracle8,pascal,per,perl,php,php-brief,pic16,pixelbender,plsql,povray,powershell,progress,prolog,providex,python,qbasic,rails,reg,robots,ruby,sas,scala,scheme,scilab,sdlbasic,smalltalk,smarty,sql,tcl,teraterm,text,thinbasic,tsql,typoscript,vb,vbnet,verilog,vhdl,vim,visualfoxpro,visualprolog,whitespace,winbatch,xml,xorg_conf,xpp,z80,';

	if ( !oSource )
	{
		oSource = FCK.EditorDocument.createElement( 'SPAN' ) ;
		oSource.className = 'fck_mw_source' ;
	}

	var sourceData = FCKTools.HTMLEncode(GetE('xSourceText').value.Trim().replace(/(\r\n|\n)/g, 'fckLR')).replace( /"/g, '&quot;' ) ;
	var lang = GetE('xSourceLang').value.Trim().toLowerCase();

	if ( lang.length && supportedLanguages.indexOf( ',' + lang + ',' ) == -1) {
		alert( (FCKLang.wikiUnsupportedLanguage || 'Unsupported language: %1').replace(/%1/, lang) );
		return false;
	}

	oSource.innerHTML = sourceData ;
	oSource.setAttribute( 'lang', lang ) ;

	if ( !oFakeImage )
	{
		oFakeImage	= oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__MWSource', oSource ) ;
		oFakeImage.setAttribute( '_fck_mw_source', 'true', 0 ) ;
		oFakeImage	= FCK.InsertElement( oFakeImage ) ;
	}

	return true ;
}

	</script>
</head>
<body style="overflow: hidden">
	<div id="divInfo">
		<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
			<tr>
				<td>
					<span fcklang="wikiSourceCode">Source Code</span>
				</td>
			</tr>
			<tr>
				<td height="100%">
					<textarea wrap=OFF id="xSourceText" style="width: 100%; height: 100%; font-family: Monospace"
						cols="50" rows="5"></textarea>
				</td>
			</tr>
			<tr>
				<td>
					<span fcklang="wikiSourceLanguage">Source Language</span><br />
					<input id="xSourceLang" type="text" size="15" />
				</td>
			</tr>
		</table>
	</div>
</body>
</html>
